package com.cyf.library.ext.lifecycle

import androidx.lifecycle.Lifecycle
import androidx.lifecycle.LifecycleObserver
import androidx.lifecycle.OnLifecycleEvent
import com.cyf.library.util.logd

object KtxAppLifeObserver : LifecycleObserver {

    var isForeground = false

    @OnLifecycleEvent(Lifecycle.Event.ON_START)
    private fun onForeground() {
        "onForeground".logd()
        isForeground = true
    }

    @OnLifecycleEvent(Lifecycle.Event.ON_STOP)
    private fun onBackground() {
        "onBackground".logd()
        isForeground = false
    }
}